import React from 'react';

class Text extends React.Component {
    displayName = 'Text';

    constructor (props) {
        super(props);
        props.datum.bindText(this.forceUpdate.bind(this));
    }

    componentWillUnmount () {
        this.props.datum.unBindText();
    }

    render () {
        const text = this.props.datum.getText().join(',');
        return <div className='cm-select-text' title={text}>{text}</div>;
    }
}

export default Text;
